<?php
if (!defined('FosfoaSystem')) {
    exit(1);
}
import($GLOBALS['spConfig']['controller_path'] . '/general.php');
class template extends general
{
    function index()
    {
        $dir = DIR_FS_CATALOG_TEMPLATES;
        if ($handle = opendir($dir)) {
            while (1) {
                $file = readdir($handle);
                //echo pathinfo($file,PATHINFO_EXTENSION);
                if ($file == "")
                    break;
                if (pathinfo($file, PATHINFO_EXTENSION) == 'php') {
                    require (DIR_FS_CATALOG_TEMPLATES . $file);
                    $template_info[$template_name] = array(
                        'name' => $template_name, 
                        'version' => $template_version,
                        'author' => $template_author, 
                        'description' => $template_description,
                        'screenshot' => $template_screenshot
                        );
                    //$tfile=iconv('GB2312', 'UTF-8', $file);
                    //$template_array[]=$tfile;
                }
            }
            //dump($template_info);
        $this->template_info = $template_info;
        } 
    }
}